import { defineConfig } from "vite"
import path from "path"
import vue from "@vitejs/plugin-vue"
import Unocss from "unocss/vite"
// element-plus按需导入
import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import { ElementPlusResolver } from "unplugin-vue-components/resolvers"
import ElementPlus from 'unplugin-element-plus/vite'
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Unocss(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
      imports:["vue","vue-router","pinia"],
      eslintrc:{enabled:false},  //给eslint生产的配置，只需要一次
    }),
    Components({
      resolvers: [ElementPlusResolver()],
      dirs: ["src/components", "src/layout/components"],
    }),
    ElementPlus({})
  ],
  resolve: {
    alias: [
      {
        find: "@",
        replacement: path.resolve(__dirname, "src"),
      },
    ],
  },
})
